/* 征信查询 */
function getChlxx(url){
	$.dpAjax({
		show:true,
		url:url,
		data:{busiId:busiId},
		success: function(datas){
			 var data = datas.result;
			 if(data){
				//车辆信息
				var ywBusinessCar = data.ywBusinessCar;
				if(ywBusinessCar) {
 					var carBrand = ywBusinessCar.nameCarBrand;
					var carSeries = ywBusinessCar.nameCarSeries;
					var carModel = ywBusinessCar.nameCarModel;
					$('#car_carBrand').text(carBrand);
					$('#car_carSeries').text(carSeries);
					$('#car_carModel').text(carModel);
					
					$('#car_categoryCar').text(ywBusinessCar.categoryCarDisplay);
					$('#car_priceNewcar').text(ywBusinessCar.priceNewcar);
					
					$('#car_carType').text(ywBusinessCar.carTypeDisplay);
					$('#car_carPlace').text(ywBusinessCar.carPlaceDisplay);
					$('#car_seatNum').text(ywBusinessCar.seatNum);
					var price = showNumber(ywBusinessCar.price);
					$('#car_price').text(price);
					$('#car_registrationArea').text(ywBusinessCar.registrationArea);
					$('#car_licencePlateType').text(ywBusinessCar.licencePlateTypeDisplay);
					$('#car_carOwnersName').text(ywBusinessCar.carOwnersName);
					$('#car_vin').text(ywBusinessCar.vin);
					$('#car_startYear').text(ywBusinessCar.startYear);
					$('#car_startMonth').text(ywBusinessCar.startMonth);
					$('#car_carStatus').text(ywBusinessCar.carStatusDisplay);
					$('#car_carPurpose').text(ywBusinessCar.carPurposeDisplay);
					$('#car_mileage').text(ywBusinessCar.mileage);
					var province = ywBusinessCar.evaluateProvinceDisplay;
					$('#car_province').text(province);
					var city = ywBusinessCar.evaluateCityDisplay;
					$('#car_city').text(city);
					$('#car_remarks').html(ywBusinessCar.remarks);
					
					//估价
    				var carAreaPrice = data.carAreaPrice;
    				$('#car_exactEstimationResult').html(carAreaPrice);
    				 if(ywBusinessCar.carType =='02' && (carAreaPrice && '' != carAreaPrice)) {//二手车，并已经评估过
    					hasExactEstimationResult();
    				 } else if(ywBusinessCar.carType =='02' && (!carAreaPrice || '' == carAreaPrice)){ //二手车，还没有评估
    					hasNotExactEstimationResult();
    				 } else { //新车
    					notUsedCar();
    				 }
 				} else {
 					che_clearBusinessCar();
 				}
				
				//车贷信息
 				var ywBusinessLoan = data.ywBusinessLoan;
 				if(ywBusinessLoan) {
 					che_showLoanData(ywBusinessLoan,ywBusinessCar.carType);
 				} else {
 					che_clearBusinessLoan();
 				}
		  }
	  }
	});
}
	
	function che_showLoanData(ywBusinessLoan,carType) {
		$('#loan_loanBank').text(ywBusinessLoan.loanBankDisplay);
		$('#loan_loanType').text(ywBusinessLoan.loanTypeDisplay);
		showType(ywBusinessLoan.loanType,ywBusinessLoan.loanBank);
		$('#loan_carPrice').text(showNumber(ywBusinessLoan.carPrice));
		$('#loan_carEstimatePrice').text(showNumber(ywBusinessLoan.carEstimatePrice));
		$('#loan_carAge').text(ywBusinessLoan.carAge);
		$('#loan_loanMonth').text(ywBusinessLoan.loanMonthDisplay);
		$('#loan_bankRate').text(showNumber((ywBusinessLoan.bankRate ? ywBusinessLoan.bankRate : 0 ) * 100, 4));
		$('#loan_loanAmount').text(showNumber(ywBusinessLoan.loanAmount));
		$('#loan_companyRate').text(showNumber((ywBusinessLoan.companyRate ? ywBusinessLoan.companyRate : 0) * 100, 4));
		$('#loan_servicePrice').text(showNumber(ywBusinessLoan.servicePrice));
		$('#loan_ccol1').text(ywBusinessLoan.ccol1Display);
		
		//结果字段
		$('#loan_signLoanAmount').text(showNumber(ywBusinessLoan.signLoanAmount));
		$('#loan_totalRepaymentAmount').text(showNumber(ywBusinessLoan.totalRepaymentAmount));
		$('#loan_bankRateAmount').text(showNumber(ywBusinessLoan.bankRateAmount ? ywBusinessLoan.bankRateAmount : 0));
		$('#loan_amountMonthly').text(showNumber(ywBusinessLoan.amountMonthly));
	    $('#loan_zhkcj').text(showNumber(ywBusinessLoan.zhkcj * 100));
	    $('#loan_qyhkcj').text(showNumber(ywBusinessLoan.qyhkcj * 100));
	    if(carType == '02') {
	    	showWarningUsed();
	    	if(ywBusinessLoan.zhkcj > 0.7) {
	    		//$('#zhkcj_show').show();
	    		$('#zhkcj_show').hide();
	    	} else {
	    		$('#zhkcj_show').hide();
	    	}
	    	if(ywBusinessLoan.qyhkcj > 0.7) {
	    		//$('#qyhkcj_show').show();
	    		$('#qyhkcj_show').hide();
	    	} else {
	    		$('#qyhkcj_show').hide();
	    	}
	    } else {
	    	showWarningNew();
	    	if(ywBusinessLoan.zhkcj > 0.8) {
	    		//$('#zhkcj_show').show();
	    		$('#zhkcj_show').hide();
	    	} else {
	    		$('#zhkcj_show').hide();
	    	}
	    	if(ywBusinessLoan.qyhkcj > 0.8) {
	    		//$('#qyhkcj_show').show();
	    		$('#qyhkcj_show').hide();
	    	} else {
	    		$('#qyhkcj_show').hide();
	    	}
	    }
		$('#loan_firstMonthTotalAmount').text(showNumber(ywBusinessLoan.firstMonthTotalAmount));
		$('#loan_monthlyPrincipalAmount').text(showNumber(ywBusinessLoan.monthlyPrincipalAmount));
		$('#loan_firstMonthAmount').text(showNumber(ywBusinessLoan.firstMonthAmount));
		$('#loan_monthlyFee').text(showNumber(ywBusinessLoan.monthlyFee));
		$('#loan_firstMonthFee').text(showNumber(ywBusinessLoan.firstMonthFee));
		$('#loan_monthlyFee2').text(showNumber(ywBusinessLoan.monthlyFee2));
		$('#loan_firstMonthFee2').text(showNumber(ywBusinessLoan.firstMonthFee2));
		$('#loan_stagesFee').text(showNumber(ywBusinessLoan.stagesFee));
		$('#loan_stagesFee2').text(showNumber(ywBusinessLoan.stagesFee2));
		
		$('#loan_sfbl').text(showNumber(ywBusinessLoan.sfbl *100));
		
		$('#loan_firstPaymentAmount').text(showNumber(ywBusinessLoan.firstPaymentAmount));
		
		$('#loan_trialAssureRate').text(showNumber(ywBusinessLoan.trialAssureRate ? ywBusinessLoan.trialAssureRate * 100 : 0, 4));
		$('#loan_assureAmount').text(showNumber(ywBusinessLoan.assureAmount));
		$('#loan_stageAmount').text(showNumber(ywBusinessLoan.stageAmount));
		$('#loan_fqbl').text(showNumber(ywBusinessLoan.fqbl ? ywBusinessLoan.fqbl * 100 : 0, 4));
		$('#loan_signFirstPaymentAmount').text(showNumber(ywBusinessLoan.loan_signFirstPaymentAmount));
		
		//首付比例js.cheng
		var loancarPrice = showNumber(ywBusinessLoan.carPrice) //购入价
		var loanloanAmount = showNumber(ywBusinessLoan.loanAmount) //实际贷款额
		var loancarEstimatePrice =showNumber(ywBusinessLoan.carEstimatePrice)//二手车估价
		
		/* chengliyong/实际贷款额/车价 */
		$("#sjdke").text(showNumber(loanloanAmount / loancarPrice * 100));
		
		/* chengliyong/实际贷款额/二手车评估价%*/
		if(loancarEstimatePrice && loancarEstimatePrice !="0.00"){
			$("#esgj").text(showNumber(loanloanAmount / loancarEstimatePrice * 100));
		}else{
			$("#esgj").text("-");
		}
		
		/* chengliyong/（中国银行订单）贷款信息页面中，签约月还款、签约首页还款 2个字段标红*/
		var loanBank = ywBusinessLoan.loanBank;
		if(loanBank != "BOC"){
			$(".BOC").find("label").removeClass("warn-red");
		}
		
		
	}
	
	function notUsedCar(){ //新车
		$('.used-car').hide();
    }
    
    function hasExactEstimationResult(){ //二手车，并已经评估过
    	$('.used-car').show();
    }
    
	function hasNotExactEstimationResult(){ //二手车，还没有评估
		$('.used-car').show();
    }
	
	function showWarningUsed(){
 		$('#zhkcj_show').text('已＞70% 建议调整');
 		$('#qyhkcj_show').text('已＞70% 建议调整');
 	}
 	function showWarningNew(){
 		$('#zhkcj_show').text('已＞80% 建议调整');
 		$('#qyhkcj_show').text('已＞80% 建议调整');
 	}
	
	function showType(loanType,loanBank){
		if(loanBank == "ICBC" && loanType == "04"){  //杭州工商平息
			$('.d3, .d2, .Tjicbc').hide();
			$('.d1, .d5').show();
			$('.dtj').hide();
		} else if(loanBank == "ICBC" && loanType == "02"){//杭州工商高息
			$('.d1, .d3, .Tjicbc').hide();
			$('.d2, .d5').show();
			$('.dtj').hide();
		}else if(loanBank == "TJICBC" && loanType == "04"){  //天津工商平息
			$('.d3, .d2').hide();
			$('.d1, .d5, .Tjicbc').show();
			$('.dtj').show();
		} else if(loanBank == "TJICBC" && loanType == "02"){//天津工商高息
			$('.d1, .d3').hide();
			$('.d2, .d5, .Tjicbc').show();
			$('.TjicbcHide').hide();
			$('.dtj').show();
		} else if(loanType == "05"){//中国银行
			$('.d1, .d2, .Tjicbc').hide();
			$('.d3, .d5').show();
			$('.dtj').hide();
		}
	}
	
	function che_clearBusinessCar(){
		$('#car_carBrand').text('-');
		$('#car_carSeries').text('-');
		$('#car_carModel').text('-');
		$('#car_priceNewcar').text('-');
		$('#car_categoryCar').text('-');
		
		$('#car_carType').text('-');
		$('#car_carPlace').text('-');
		$('#car_seatNum').text('-');
		$('#car_price').text('-');
		$('#car_registrationArea').text('-');
		$('#car_licencePlateType').text('-');
		$('#car_carOwnersName').text('-');
		$('#car_vin').text('-');
		$('#car_startYear').text('-');
		$('#car_startMonth').text('-');
		$('#car_carStatus').text('-');
		$('#car_carPurpose').text('-');
		$('#car_mileage').text('-');
		$('#car_province').text('-');
		$('#car_city').text('-');
		$('#car_exactEstimationResult').html('-');
		$('#car_remarks').html('-');
	}
	function che_clearBusinessLoan(){
		$('#loan_loanBank').text('-');
		$('#loan_loanType').text('-');
		$('#loan_carPrice').text('-');
		$('#loan_carEstimatePrice').text('-');
		$('#loan_carAge').text('-');
		$('#loan_loanMonth').text('-');
		$('#loan_bankRate').text('-');
		$('#loan_loanAmount').text('-');
		$('#loan_companyRate').text('-');
		$('#loan_servicePrice').text('-');
		
		//结果字段
		$('#loan_signLoanAmount').text('-');
		$('#loan_totalRepaymentAmount').text('-');
		$('#loan_bankRateAmount').text('-');
		$('#loan_amountMonthly').text('-');
		$('#loan_sfbl').text('-');
	    $('#loan_zhkcj').text('-');
		$('#loan_qyhkcj').text('-');
		$('#loan_firstMonthTotalAmount').text('-');
		$('#loan_monthlyPrincipalAmount').text('-');
		$('#loan_firstMonthAmount').text('-');
		$('#loan_monthlyFee').text('-');
		$('#loan_firstMonthFee').text('-');
		$('#loan_monthlyFee2').text('-');
		$('#loan_firstMonthFee2').text('-');
		$('#loan_stagesFee').text('-');
		$('#loan_stagesFee2').text('-');
		$('#loan_sfAmount').html('-');
		$('#loan_trialAssureRate').text('-');
		$('#loan_assureAmount').text('-');
		$('#loan_stageAmount').text('-');
		$('#loan_fqbl').text('-');
		$('#loan_signFirstPaymentAmount').text('-');
	}